import { v4 as uuid } from "uuid";

export const skuNumReg = /^[1-9]\d?$|^1\d{2}$|^200$/;

// 获取临时ID
export const getTempId = () => {
  const tempID = window.localStorage.getItem("USER_TEMP_ID");
  if (!tempID) {
    const uid = uuid();
    window.localStorage.setItem("USER_TEMP_ID", uid);
    return uid;
  }
  return tempID;
};

// 保存token
export const saveToken = (token) => localStorage.setItem("TOKEN", token);

// 读取token
export const getToken = () => localStorage.getItem("TOKEN");
